-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Improved command-line arguments parsing #83
Conversation
… making options global and exclusive
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #83 +/- ##
==========================================
+ Coverage 89.18% 89.24% +0.06%
==========================================
Files 47 47
Lines 3459 3516 +57
Branches 669 688 +19
==========================================
+ Hits 3085 3138 +53
- Misses 338 339 +1
- Partials 36 39 +3 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Some nits here and there, we've discussed the std::for_each
at length and I agree it can improve readability of the lambda on certain uses (like this one).
…eArgument() to be able to take a set of options to recognise through the recursion step
…of global options through recursive arguments_t::parseFrom() calls
…bypass the required arguments checking if exactly one is given
A broken `= default;` in the header is recoverable by forward declaring in the header, then using it in a translation unit (once the class is complete).
b7c8c48
to
dee2062
Compare
…r `noexcept` markings noting that std::multiset can throw when copied
dee2062
to
b74a01b
Compare
In this PR we seek to improve the state of the command line arguments parser by implementing two new features that solve usability problems and bring us closer to parity with Rust's Clap and Python's argparse.
The first of these new features is option exclusivity, whereby you can define multiple options at a parsing level to be exclusive of one another and bypass requirements checks for normal options - this is done with the new options_t helper
.exclusive()
and allows, eg,--version
and--help
to be defined and made exclusive of each other + uncaring of other arguments requirements validity.The second of these features is option globalness, whereby an option can be defined to be "global" (visible to its level and all parsing levels below that) such as a
--help
option that should appear on every level of parsing (through optionSet_t barriers) to improve the usage of the parser.